package cn.itcast.mapper;

import cn.itcast.pojo.StudentGrade;
import cn.itcast.pojo.Students;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;
import java.util.List;

@Mapper
public interface StudentsMapper extends BaseMapper<Students> {
    List<Students> findAllColStudents(
            @Param("name") String name,
            @Param("degree") Integer degree,
            @Param("classId") Integer classId,
            @Param("page") Integer page,
            @Param("pageSize") Integer pageSize);

    int deleteById(ArrayList<Integer> ids);

    int addStudents(Students students);

    @Select("select * from students where id=#{id}")
    Students findStudentsById(Integer id);

    @Update("update students set name=#{name},no=#{no},gender=#{gender},phone=#{phone},degree=#{degree},id_card=#{idCard},is_college=#{isCollege},address=#{address},graduation_date=#{graduationDate},violation_count=#{violationCount},violation_score=#{violationScore},clazz_id=#{clazzId},clazz_name=#{clazzName},update_time=#{updateTime} where id=#{id}")
    int updateStudents(Students students);

    int discipline(
            @Param("id") Integer id,
            @Param("score") Integer score);

    List<StudentGrade> studentDegreeData();
}
